<style>
#set_pwd{
	margin:20px auto!important;
	width:50%!important;
}

#set_pwd input.form-control{
	display:inline-block;
	width:235px;
}
</style>
<form class="form-horizontal validate" role="form" method="post" id="set_pwd">
		<div class="form-group">
			<label class="col-sm-4 control-label">旧密码：</label>
			<div class="col-sm-8">
				<input type="password" class="form-control easyui-validatebox" name="password" data-options="required:true">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-4 control-label">新密码：</label>
			<div class="col-sm-8">
				<input type="password" class="form-control easyui-validatebox" name="new_pw_edit" data-options="required:true">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-4 control-label">确认新密码：</label>
			<div class="col-sm-8">
				<input type="password" class="form-control easyui-validatebox" name="pwd_confirm_edit" data-options="required:true">
			</div>
		</div>
		<div class="form-group" style="text-align: center">
			<button class="btn btn-danger" type="button" onclick="save_user_password(this)">保存密码修改</button>
		</div>
	</form>

<script>
function save_user_password(e){
	if($('[name=new_pw_edit]').val()!=$('[name=pwd_confirm_edit]').val()){
		Core.error('新密码与确认密码不相同！');return false;	
	}
	$(e).parents('form').form('submit',{
		ajax:true,
		url:'manager/save_pwd',
		onSubmit: function(){
			return $(this).form('enableValidation').form('validate');
		},
		success:function(c){
			switch(c){
				case "1": Core.error('无效的用户ID','error'); break;
				case "2": Core.error('旧密码不匹配，请重新输入','error'); break;
				case "3": Core.error('两次密码输入不一致，请重新输入','error'); break;
				case 'OK': Core.ok('密码修改成功'); break;
				default: Core.error(c); 
			}
		}
	});
}
</script>